package com.icss.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import com.icss.entity.Menu;
import com.icss.entity.Restaurant;
import com.icss.entity.Review;
public interface MenuDao {
@Select("select * from menu,menuclass where DishId=#{DishId} and menu.MenuClassid=menuclass.MenuClassid ") 
public List<Menu> showmenuinfo(Integer DishId);
@Select("select * from menu,menuclass where menu.MenuClassid=menuclass.MenuClassid")
public List<Menu> manmenu();
@Insert("insert into menu(MenuClassid,DishName,DishPrice,DishPicture,DishState,dishDescribe) values (#{0},#{1},#{2},#{3},'在售',#{4})")
public int addMenu(Integer MenuClassid,String DishName,Integer DishPrice,String DishPicture,String dishDescribe);
@SelectProvider(method = "searchmenu", type =MenuProvider.class)
public List<Menu> searchmenu(Menu menu);
@Delete("delete from menu where DishId=#{dishId} ")
public int  deletemenu(Integer dishId);
@Update("update menu set Menuclassid=#{0},DishName=#{1},DishPrice=#{2},DishPicture=#{3},DishState=#{4},dishDescribe=#{6} where DishId=#{5} ")
public int updatemenu(Integer MenuClassid,String DishName,Integer DishPrice,String DishPicture,String DishState,Integer DishId,String dishDescribe);
@Select("select * from (select *,ROW_NUMBER() over(order by DishId desc) as fid from menu)t where fid<=4")
public List<Menu> recommand();
@Select("select * from menu,menuclass where menu.MenuClassid=menuclass.MenuClassid and menu.MenuClassid<>1")
public List<Menu> eatmenu();
@Select("select * from menu,menuclass where menu.MenuClassid=menuclass.MenuClassid and menu.MenuClassid=1 ")
public List<Menu> drinkmenu();
@Select("select *  from menu,menuclass where menu.MenuClassid=menuclass.MenuClassid and menu.MenuClassid=#{menuClassid}")
public List<Menu> menukind(Integer menuClassid);
@Select("select * from restaurant")
public List<Restaurant> showrestaurant();
@Update("update restaurant set RName=#{0},RAddress=#{1},RTel=#{2} where RId=#{3}")
public int updaterestaurant(String rName, String rAddress, int rTel,int RId );
@Select("select * from menu where DishId=#{0}")
public Menu showhistory(Integer dishId);
@Select("select * from menu,wishmenu where c_id=#{c_id} and menu.DishId=wishmenu.DishId")
public List<Menu> selectwish(int c_id);
@Delete("delete from wishmenu where id=#{id}")
public int deletewish(Integer id);
@Insert("insert into wishmenu values(default,#{0},#{1})")
public int inserwish(Integer dishId, int c_id);


}



